package com.ihr360.job.core.listener;

import com.ihr360.job.core.ItemProcessListener;
import com.ihr360.job.core.ItemReadListener;
import com.ihr360.job.core.ItemWriteListener;
import com.ihr360.job.core.scope.context.SimpleStepContext;

import java.util.List;

/**
 * Basic no-op implementation of the {@link ItemReadListener},
 * {@link ItemProcessListener}, and {@link ItemWriteListener} interfaces. All
 * are implemented, since it is very common that all may need to be implemented
 * at once.
 *
 * @author Lucas Ward
 */
public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProcessListener<I, O>, ItemWriteListener<O> {

    @Override
    public void afterRead(I item) {
    }

    @Override
    public void beforeRead(SimpleStepContext simpleStepContext) {
    }

    @Override
    public void onReadError(SimpleStepContext simpleStepContext,Exception ex) {
    }

    @Override
    public void afterProcess(I item, O result) {
    }

    @Override
    public void beforeProcess(I item, SimpleStepContext context) {
    }

    @Override
    public void onProcessError(I item, SimpleStepContext context, Exception e) {
    }

    @Override
    public void afterWrite(List<? extends O> item) {
    }

    @Override
    public void beforeWrite(List<? extends O> item) {
    }

    @Override
    public void onWriteError(Exception ex, List<? extends O> item) {
    }
}
